package main

import (
	"fmt"
	"time"
)

func main() {
	tz, _ := time.LoadLocation("Asia/Shanghai") // 使用名字
	s1 := "2022/09/08 20:36:50"
	s2 := "2022/09/08 21:40:51"
	layout := "2006/01/02 15:04:05"
	t1, _ := time.ParseInLocation(layout, s1, tz)
	t2, _ := time.ParseInLocation(layout, s2, tz)
	fmt.Println(t1)
	fmt.Println(t2)
	delta := t2.Sub(t1)
	fmt.Printf("%T %[1]v\n", delta)

	t3 := t2.Add(2)
	delta = t3.Sub(t2)
	fmt.Println(delta.Seconds())
	fmt.Println(t3.After(t2))

	start := time.Now()
	fmt.Println(time.Since(start)) // 计算时间差
}
